package com.nkzy.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.URL;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    @NotNull
    private Integer id;
    private String username;
    @JsonIgnore//让SpringMVC把当前对象转换成JSON字符串时，不计password
    private String password;
    @NotEmpty
    @Pattern(regexp = "^\\s{5,16}$")
    private String nickname;
    @NotEmpty
    @Email
    private String email;
    @URL
    private String userPic;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
}
